package com.traffic.fuwu.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.traffic.fuwu.dao.VehAppCarryMapper;
import com.traffic.fuwu.mybatis.pojo.VehAppCarry;
import com.traffic.fuwu.mybatis.pojo.VehAppCarryExample;
import com.traffic.fuwu.service.VehAppCarryService;

@Service
public class VehAppCarryServiceImpl implements VehAppCarryService {
	@Autowired
	private VehAppCarryMapper vehAppCarryMapper;

	@Override
	public List<VehAppCarry> getAppCarry(Map<String, Object> conditions) {
		try {
			List<VehAppCarry> list = vehAppCarryMapper.getAppCarry(conditions);
			if (list != null && list.size() != 0) {
				return list;
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

	@Override
	public int getAppCarryCount(Map<String, Object> conditions) {
		try {
			
			int count = vehAppCarryMapper.getAppCarryCount(conditions);
			if (count != 0) {
				return count;
			}
			
		} catch (Exception e) {
			e.printStackTrace();
		}
		return 0;
	}

	@Override
	public VehAppCarry getById(int dataId) {
		VehAppCarryExample example = new VehAppCarryExample();
		example.or().andDataidEqualTo(dataId);
		List<VehAppCarry> list = vehAppCarryMapper.selectByExample(example);
		if (list != null && list.size() != 0) {
			VehAppCarry vehAppCarry = list.get(0);
			return vehAppCarry;
		}
		return null;
	}

	@Override
	public void addVehAppCarry(VehAppCarry vehAppCarry) {
		vehAppCarryMapper.insert(vehAppCarry);

	}

	@Override
	public void updateVehAppCarry(VehAppCarry vehAppCarry) {
		vehAppCarryMapper.updateByPrimaryKey(vehAppCarry);

	}

}
